package org.example.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class TestZipInputStream {
    public static void main(String[] args) throws Exception{
        //创建解压流
        ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(new File("D:\\tmp\\a.zip")));
        //处理文件
        ZipEntry nextEntry = zipInputStream.getNextEntry();
        //创建输出流
        FileOutputStream stream = new FileOutputStream("D:\\tmp\\111.txt");
        //写入数据
        int i;
        while ((i = zipInputStream.read())!=-1){
            stream.write(i);
        }
        //关闭流
        stream.close();
        zipInputStream.close();
    }
}
